//
// Created by the DataSnap proxy generator.
// 2013-08-22 16:21:07
//

unit ClientClassesUnit1;

interface

uses Datasnap.DSProxyRest, Datasnap.DSClientRest, Data.DBXCommon, Data.DBXClient, Data.DBXDataSnap, Data.DBXJSON, Datasnap.DSProxy, System.Classes, System.SysUtils, Data.DB, Data.SqlExpr, Data.DBXDBReaders, Data.DBXCDSReaders, Data.DBXJSONReflect;

type
  TServerMethods1Client = class(TDSAdminRestClient)
  private
    FDSServerModuleCreateCommand: TDSRestCommand;
    FGetMenuItemsCommand: TDSRestCommand;
    FGetCategoryItemsCommand: TDSRestCommand;
    FGetTablePagesCommand: TDSRestCommand;
    FGetTableLayoutCommand: TDSRestCommand;
    FGetProfileCommand: TDSRestCommand;
    FGetMenuInstructionLinkCommand: TDSRestCommand;
    FGetVIPTableCommand: TDSRestCommand;
    FSaveOrderCommand: TDSRestCommand;
    FSaveLockNameCommand: TDSRestCommand;
    FGetOrderByTableNoCommand: TDSRestCommand;
    FGetOrderItemByOrderNoCommand: TDSRestCommand;
  public
    constructor Create(ARestConnection: TDSRestConnection); overload;
    constructor Create(ARestConnection: TDSRestConnection; AInstanceOwner: Boolean); overload;
    destructor Destroy; override;
    procedure DSServerModuleCreate(Sender: TObject);
    function GetMenuItems(const ARequestFilter: string = ''): string;
    function GetCategoryItems(const ARequestFilter: string = ''): string;
    function GetTablePages(const ARequestFilter: string = ''): string;
    function GetTableLayout(const ARequestFilter: string = ''): string;
    function GetProfile(const ARequestFilter: string = ''): string;
    function GetMenuInstructionLink(const ARequestFilter: string = ''): string;
    function GetVIPTable(const ARequestFilter: string = ''): string;
    function SaveOrder(OrderNo: string; TableNo: string; sql: string; const ARequestFilter: string = ''): Boolean;
    function SaveLockName(cliTableNo: string; const ARequestFilter: string = ''): Boolean;
    function GetOrderByTableNo(TableNo: string; const ARequestFilter: string = ''): string;
    function GetOrderItemByOrderNo(OrderNo: string; const ARequestFilter: string = ''): string;
  end;

const
  TServerMethods1_DSServerModuleCreate: array [0..0] of TDSRestParameterMetaData =
  (
    (Name: 'Sender'; Direction: 1; DBXType: 37; TypeName: 'TObject')
  );

  TServerMethods1_GetMenuItems: array [0..0] of TDSRestParameterMetaData =
  (
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

  TServerMethods1_GetCategoryItems: array [0..0] of TDSRestParameterMetaData =
  (
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

  TServerMethods1_GetTablePages: array [0..0] of TDSRestParameterMetaData =
  (
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

  TServerMethods1_GetTableLayout: array [0..0] of TDSRestParameterMetaData =
  (
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

  TServerMethods1_GetProfile: array [0..0] of TDSRestParameterMetaData =
  (
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

  TServerMethods1_GetMenuInstructionLink: array [0..0] of TDSRestParameterMetaData =
  (
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

  TServerMethods1_GetVIPTable: array [0..0] of TDSRestParameterMetaData =
  (
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

  TServerMethods1_SaveOrder: array [0..3] of TDSRestParameterMetaData =
  (
    (Name: 'OrderNo'; Direction: 1; DBXType: 26; TypeName: 'string'),
    (Name: 'TableNo'; Direction: 1; DBXType: 26; TypeName: 'string'),
    (Name: 'sql'; Direction: 1; DBXType: 26; TypeName: 'string'),
    (Name: ''; Direction: 4; DBXType: 4; TypeName: 'Boolean')
  );

  TServerMethods1_SaveLockName: array [0..1] of TDSRestParameterMetaData =
  (
    (Name: 'cliTableNo'; Direction: 1; DBXType: 26; TypeName: 'string'),
    (Name: ''; Direction: 4; DBXType: 4; TypeName: 'Boolean')
  );

  TServerMethods1_GetOrderByTableNo: array [0..1] of TDSRestParameterMetaData =
  (
    (Name: 'TableNo'; Direction: 1; DBXType: 26; TypeName: 'string'),
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

  TServerMethods1_GetOrderItemByOrderNo: array [0..1] of TDSRestParameterMetaData =
  (
    (Name: 'OrderNo'; Direction: 1; DBXType: 26; TypeName: 'string'),
    (Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
  );

implementation

procedure TServerMethods1Client.DSServerModuleCreate(Sender: TObject);
begin
  if FDSServerModuleCreateCommand = nil then
  begin
    FDSServerModuleCreateCommand := FConnection.CreateCommand;
    FDSServerModuleCreateCommand.RequestType := 'POST';
    FDSServerModuleCreateCommand.Text := 'TServerMethods1."DSServerModuleCreate"';
    FDSServerModuleCreateCommand.Prepare(TServerMethods1_DSServerModuleCreate);
  end;
  if not Assigned(Sender) then
    FDSServerModuleCreateCommand.Parameters[0].Value.SetNull
  else
  begin
    FMarshal := TDSRestCommand(FDSServerModuleCreateCommand.Parameters[0].ConnectionHandler).GetJSONMarshaler;
    try
      FDSServerModuleCreateCommand.Parameters[0].Value.SetJSONValue(FMarshal.Marshal(Sender), True);
      if FInstanceOwner then
        Sender.Free
    finally
      FreeAndNil(FMarshal)
    end
    end;
  FDSServerModuleCreateCommand.Execute;
end;

function TServerMethods1Client.GetMenuItems(const ARequestFilter: string): string;
begin
  if FGetMenuItemsCommand = nil then
  begin
    FGetMenuItemsCommand := FConnection.CreateCommand;
    FGetMenuItemsCommand.RequestType := 'GET';
    FGetMenuItemsCommand.Text := 'TServerMethods1.GetMenuItems';
    FGetMenuItemsCommand.Prepare(TServerMethods1_GetMenuItems);
  end;
  FGetMenuItemsCommand.Execute(ARequestFilter);
  Result := FGetMenuItemsCommand.Parameters[0].Value.GetWideString;
end;

function TServerMethods1Client.GetCategoryItems(const ARequestFilter: string): string;
begin
  if FGetCategoryItemsCommand = nil then
  begin
    FGetCategoryItemsCommand := FConnection.CreateCommand;
    FGetCategoryItemsCommand.RequestType := 'GET';
    FGetCategoryItemsCommand.Text := 'TServerMethods1.GetCategoryItems';
    FGetCategoryItemsCommand.Prepare(TServerMethods1_GetCategoryItems);
  end;
  FGetCategoryItemsCommand.Execute(ARequestFilter);
  Result := FGetCategoryItemsCommand.Parameters[0].Value.GetWideString;
end;

function TServerMethods1Client.GetTablePages(const ARequestFilter: string): string;
begin
  if FGetTablePagesCommand = nil then
  begin
    FGetTablePagesCommand := FConnection.CreateCommand;
    FGetTablePagesCommand.RequestType := 'GET';
    FGetTablePagesCommand.Text := 'TServerMethods1.GetTablePages';
    FGetTablePagesCommand.Prepare(TServerMethods1_GetTablePages);
  end;
  FGetTablePagesCommand.Execute(ARequestFilter);
  Result := FGetTablePagesCommand.Parameters[0].Value.GetWideString;
end;

function TServerMethods1Client.GetTableLayout(const ARequestFilter: string): string;
begin
  if FGetTableLayoutCommand = nil then
  begin
    FGetTableLayoutCommand := FConnection.CreateCommand;
    FGetTableLayoutCommand.RequestType := 'GET';
    FGetTableLayoutCommand.Text := 'TServerMethods1.GetTableLayout';
    FGetTableLayoutCommand.Prepare(TServerMethods1_GetTableLayout);
  end;
  FGetTableLayoutCommand.Execute(ARequestFilter);
  Result := FGetTableLayoutCommand.Parameters[0].Value.GetWideString;
end;

function TServerMethods1Client.GetProfile(const ARequestFilter: string): string;
begin
  if FGetProfileCommand = nil then
  begin
    FGetProfileCommand := FConnection.CreateCommand;
    FGetProfileCommand.RequestType := 'GET';
    FGetProfileCommand.Text := 'TServerMethods1.GetProfile';
    FGetProfileCommand.Prepare(TServerMethods1_GetProfile);
  end;
  FGetProfileCommand.Execute(ARequestFilter);
  Result := FGetProfileCommand.Parameters[0].Value.GetWideString;
end;

function TServerMethods1Client.GetMenuInstructionLink(const ARequestFilter: string): string;
begin
  if FGetMenuInstructionLinkCommand = nil then
  begin
    FGetMenuInstructionLinkCommand := FConnection.CreateCommand;
    FGetMenuInstructionLinkCommand.RequestType := 'GET';
    FGetMenuInstructionLinkCommand.Text := 'TServerMethods1.GetMenuInstructionLink';
    FGetMenuInstructionLinkCommand.Prepare(TServerMethods1_GetMenuInstructionLink);
  end;
  FGetMenuInstructionLinkCommand.Execute(ARequestFilter);
  Result := FGetMenuInstructionLinkCommand.Parameters[0].Value.GetWideString;
end;

function TServerMethods1Client.GetVIPTable(const ARequestFilter: string): string;
begin
  if FGetVIPTableCommand = nil then
  begin
    FGetVIPTableCommand := FConnection.CreateCommand;
    FGetVIPTableCommand.RequestType := 'GET';
    FGetVIPTableCommand.Text := 'TServerMethods1.GetVIPTable';
    FGetVIPTableCommand.Prepare(TServerMethods1_GetVIPTable);
  end;
  FGetVIPTableCommand.Execute(ARequestFilter);
  Result := FGetVIPTableCommand.Parameters[0].Value.GetWideString;
end;

function TServerMethods1Client.SaveOrder(OrderNo: string; TableNo: string; sql: string; const ARequestFilter: string): Boolean;
begin
  if FSaveOrderCommand = nil then
  begin
    FSaveOrderCommand := FConnection.CreateCommand;
    FSaveOrderCommand.RequestType := 'GET';
    FSaveOrderCommand.Text := 'TServerMethods1.SaveOrder';
    FSaveOrderCommand.Prepare(TServerMethods1_SaveOrder);
  end;
  FSaveOrderCommand.Parameters[0].Value.SetWideString(OrderNo);
  FSaveOrderCommand.Parameters[1].Value.SetWideString(TableNo);
  FSaveOrderCommand.Parameters[2].Value.SetWideString(sql);
  FSaveOrderCommand.Execute(ARequestFilter);
  Result := FSaveOrderCommand.Parameters[3].Value.GetBoolean;
end;

function TServerMethods1Client.SaveLockName(cliTableNo: string; const ARequestFilter: string): Boolean;
begin
  if FSaveLockNameCommand = nil then
  begin
    FSaveLockNameCommand := FConnection.CreateCommand;
    FSaveLockNameCommand.RequestType := 'GET';
    FSaveLockNameCommand.Text := 'TServerMethods1.SaveLockName';
    FSaveLockNameCommand.Prepare(TServerMethods1_SaveLockName);
  end;
  FSaveLockNameCommand.Parameters[0].Value.SetWideString(cliTableNo);
  FSaveLockNameCommand.Execute(ARequestFilter);
  Result := FSaveLockNameCommand.Parameters[1].Value.GetBoolean;
end;

function TServerMethods1Client.GetOrderByTableNo(TableNo: string; const ARequestFilter: string): string;
begin
  if FGetOrderByTableNoCommand = nil then
  begin
    FGetOrderByTableNoCommand := FConnection.CreateCommand;
    FGetOrderByTableNoCommand.RequestType := 'GET';
    FGetOrderByTableNoCommand.Text := 'TServerMethods1.GetOrderByTableNo';
    FGetOrderByTableNoCommand.Prepare(TServerMethods1_GetOrderByTableNo);
  end;
  FGetOrderByTableNoCommand.Parameters[0].Value.SetWideString(TableNo);
  FGetOrderByTableNoCommand.Execute(ARequestFilter);
  Result := FGetOrderByTableNoCommand.Parameters[1].Value.GetWideString;
end;

function TServerMethods1Client.GetOrderItemByOrderNo(OrderNo: string; const ARequestFilter: string): string;
begin
  if FGetOrderItemByOrderNoCommand = nil then
  begin
    FGetOrderItemByOrderNoCommand := FConnection.CreateCommand;
    FGetOrderItemByOrderNoCommand.RequestType := 'GET';
    FGetOrderItemByOrderNoCommand.Text := 'TServerMethods1.GetOrderItemByOrderNo';
    FGetOrderItemByOrderNoCommand.Prepare(TServerMethods1_GetOrderItemByOrderNo);
  end;
  FGetOrderItemByOrderNoCommand.Parameters[0].Value.SetWideString(OrderNo);
  FGetOrderItemByOrderNoCommand.Execute(ARequestFilter);
  Result := FGetOrderItemByOrderNoCommand.Parameters[1].Value.GetWideString;
end;

constructor TServerMethods1Client.Create(ARestConnection: TDSRestConnection);
begin
  inherited Create(ARestConnection);
end;

constructor TServerMethods1Client.Create(ARestConnection: TDSRestConnection; AInstanceOwner: Boolean);
begin
  inherited Create(ARestConnection, AInstanceOwner);
end;

destructor TServerMethods1Client.Destroy;
begin
  FreeAndNil(FDSServerModuleCreateCommand);
  FreeAndNil(FGetMenuItemsCommand);
  FreeAndNil(FGetCategoryItemsCommand);
  FreeAndNil(FGetTablePagesCommand);
  FreeAndNil(FGetTableLayoutCommand);
  FreeAndNil(FGetProfileCommand);
  FreeAndNil(FGetMenuInstructionLinkCommand);
  FreeAndNil(FGetVIPTableCommand);
  FreeAndNil(FSaveOrderCommand);
  FreeAndNil(FSaveLockNameCommand);
  FreeAndNil(FGetOrderByTableNoCommand);
  FreeAndNil(FGetOrderItemByOrderNoCommand);
  inherited;
end;

end.

